/*
 * @Author: luoqi
 * @Date: 2022-04-12 17:34:29
 * @LastEditors: luoqi
 * @LastEditTime: 2022-04-17 18:23:00
 * @Description: 
 */
/*
 * @Author: luoqi
 * @Date: 2022-03-29 10:50:06
 * @LastEditors: luoqi
 * @LastEditTime: 2022-04-12 15:08:03
 * @Description: 
 */
import React, { useState } from 'react';
import { Button, Modal, Descriptions , Input, Radio, Select, Upload, message } from 'antd';
import { connect } from 'react-redux'
import style from './style.module.css'

const PreviewKnowledeg = (props) => {
  const { departmentTree, partTree } = props.types;
  const {data}=props
  // console.log(data);
  const [isModalVisible, setIsModalVisible] = useState(false);
  const showModal = () => {
    setIsModalVisible(true);
  };

  const handleOk = () => {
    setIsModalVisible(false);
  };

  const handleCancel = () => {
    setIsModalVisible(false);
  };
  


  return (
    <div>
      <Button type="primary" ghost onClick={showModal}>
        预览
      </Button>
      <Modal title="预览知识" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel} okText="确定" style={{width:'1500px'}} width={800}
        cancelText="取消">
        <Descriptions title={data.title}>
          <Descriptions.Item label="标签">{data.tag}</Descriptions.Item>
          <Descriptions.Item label="发布人">{data.adminId}</Descriptions.Item>
          <Descriptions.Item label="发布时间">{data.time}</Descriptions.Item>
          <Descriptions.Item label="内容" span={3}>
            {/* 把html字符串强转为html */}
            <div className={style.content} dangerouslySetInnerHTML={{__html: data.content}} ></div>
          </Descriptions.Item>
        </Descriptions>
      </Modal>
    </div>
  );
}

export default connect(
  state => ({ types: state.types }),
  {}
)(PreviewKnowledeg);
